package com.ny.interceptor;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;
@Configuration
public class MyWebMvcConfig implements WebMvcConfigurer {
    @Resource
    LoginInterceptor loginInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        /**
         * 登录拦截器
         * */
        registry.addInterceptor(loginInterceptor)
                .addPathPatterns("/selectUser")
                .addPathPatterns("/sendEmail")
                .excludePathPatterns("/findUser")
                .excludePathPatterns("/register")
                .excludePathPatterns("/device/findAll")
                .order(1);

    }
}

